﻿Imports System.Windows.Forms
Imports Abyx.SVCMS
Imports Abyx.SVCMS.Library
Imports Abyx.WindowsExtendedControls

Public Class SEC_PasswordSetup_Dialog

    Public Password As String = ""
    Public Title As String = "User Password Setup"

#Region "Events"
    Public Shadows Function ShowDialog() As DialogResult
        InitializeVariables()
        InitializeControls()
        Return MyBase.ShowDialog()
    End Function
    Private Sub SEC_AdminPasswordSetup_Dialog_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        InitializeVariables()
        InitializeControls()
    End Sub
    Private Sub Commit_ImageButton_Click(sender As System.Object, e As System.EventArgs) Handles Commit_ImageButton.Click

        If Password1_TextBox.Text <> Password2_TextBox.Text Then
            AMsg.ShowDialog("Password confirmation failed, retype passwords and try again", MsgBoxStyle.Critical)
        Else
            Me.DialogResult = System.Windows.Forms.DialogResult.OK
            Me.Password = Me.Password1_TextBox.Text
            Me.Close()
        End If

    End Sub
    Private Sub Cancel_ImageButton_Click(sender As System.Object, e As System.EventArgs) Handles Cancel_ImageButton.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub
#End Region

#Region "Private Procedures"
    Private Sub InitializeVariables()
        Me.Password = ""
    End Sub
    Private Sub InitializeControls()

        'Set dialog title
        Me.Text = Me.Title

        'Clear controls
        Me.Password1_TextBox.Text = ""
        Me.Password2_TextBox.Text = ""

    End Sub
#End Region


End Class
